#!/usr/bin/env python
# -*- coding: UTF-8 -*-
'''
@Project ：图灵学习 
@File    ：8.请求参数-查询字符串.py
@IDE     ：PyCharm 
@Author  ：ChenLiGao
@Date    ：2024-11-20 10:05
'''
import requests

# 请求头
headers = {
    "User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36"
}

# # 声明请求网站地址
# url = "https://www.baidu.com/s?wd=哈士奇"
#
# # 请求头
# headers = {
#     "User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36"
# }
#
#
# # 访问指定地址，
# # params：接收是拆线呢字符串参数，参数的类型是字典
# response = requests.get(url, headers=headers)
# print(response.content.decode())
#
# print("地址：", response.url)


# 声明请求网站地址
url = "https://www.baidu.com/s?wd=哈士奇"


kw = {
    "wd":"哈士奇"
}

# 访问指定地址，
# params：接收是拆线呢字符串参数，参数的类型是字典
response = requests.get(url, headers=headers, params=kw)
print(response.content.decode())

print("地址：", response.url)